package router

import (
	ctrl "a-admin/web/controller"
	midd "a-admin/web/middleware"

	"github.com/gofiber/fiber/v2"
)

func InitSysMenuRoutes(r fiber.Router) {
	server := ctrl.NewSysMenuController()
	// 鉴权组
	rg := r.Group("")
	{
		rg.Get("/admin/auth.Rule/index", server.List)
		rg.Post("/admin/auth.Rule/edit", server.Edit)
		rg.Get("/admin/auth.Rule/edit", server.Get)

		rg.Get("/list", server.List)
		rg.Get("/treeselect", midd.PermsHandler("system:menu:query"), server.GetTree)
		rg.Get("/getTree", server.GetTree)
		rg.Get("/getTreeSelect", server.GetTreeSelect)
		rg.Get("/roleMenuTreeselect/:id", server.RoleMenuTreeSelect)
		rg.Get("/:id", midd.PermsHandler("system:menu:query"), server.Get)
		rg.Delete("/:ids", midd.PermsHandler("system:menu:remove"), server.Del)
		rg.Post("", midd.PermsHandler("system:menu:add"), server.Add)
		rg.Put("", midd.PermsHandler("system:menu:edit"), server.Edit)
	}
}
